package com.eeepay.eeepay_v2.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.eeepay.eeepay_v2.R;
import com.eeepay.eeepay_v2.util.Constant;
import com.eeepay.v2_library.ui.ABBaseActivity;
import com.eeepay.v2_library.view.HorizontalItemView;

/**
 * Created by zw on 2016/3/14 0014.
 */
public class AgentDetailsActivity extends ABBaseActivity implements View.OnClickListener {

    //基本信息、 代理产品、 分润信息  费率  限额
    private HorizontalItemView baseInfo, agenProduct, profitInfo, serveRate, serveQuota;
    private TextView tv_agentName;
    private String agentId, agentName,isdirectchild;//

    @Override
    protected int getLayoutId() {
        return R.layout.activity_agent_details;
    }

    @Override
    protected void initWidget() {
        if(bundle != null){
            agentId = bundle.getString(Constant.AGENT_ID);
            agentName = bundle.getString(Constant.AGENT_NAME);
            //是否为直接下级 "true" : 是; "false"
            isdirectchild = bundle.getString(Constant.ISDIRECTCHILD);
        }
        baseInfo = getViewById(R.id.hv_base_info);
        agenProduct = getViewById(R.id.hv_agen_product);
        profitInfo = getViewById(R.id.hv_profit_info);
        serveRate = getViewById(R.id.hv_serve_rete);
        serveQuota = getViewById(R.id.hv_serve_quota);
        tv_agentName = getViewById(R.id.tv_agent_name);
        tv_agentName.setText(agentName);
    }

    @Override
    protected void eventOnClick() {
        baseInfo.setOnClickListener(this);
        agenProduct.setOnClickListener(this);
        profitInfo.setOnClickListener(this);
        serveRate.setOnClickListener(this);
        serveQuota.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Bundle bundle = new Bundle();
        bundle.putString(Constant.AGENT_ID, agentId);
        bundle.putString(Constant.ISDIRECTCHILD, isdirectchild);
        switch (v.getId()){
            case R.id.hv_base_info:
                goActivity(AgentBaseInfoActivity.class, bundle);
                break;
            case R.id.hv_agen_product:
                goActivity(AgentProductActivity.class, bundle);
                break;
            case R.id.hv_profit_info:
                goActivity(ProfitInfoActivity.class, bundle);
                break;
            case R.id.hv_serve_rete:
                goActivity(ServeRateActivity.class, bundle);
                break;
            case R.id.hv_serve_quota:
                goActivity(ServeQuotaActivity.class, bundle);
                break;
        }
    }
}
